/**
 * Created by Administrator on 2017/1/18.
 */
function  submit(){
    var e = window.event || arguments.callee.caller.arguments[0];
    if (e && e.keyCode == 13 ) {
       $("#submit").click();
    }
}
$("#submit").bind("click", function() {
    var userName = $("#userName").val();
    var password = $("#password").val();
    if(userName==''){
        $("#errorMsg").html("用户名不能为空！");
        $("#errorMsg").css("display","block");
        return false;
    }else if(password==''){
        $("#errorMsg").html("密码不能为空！");
        $("#errorMsg").css("display","block");
        return false;
    };
    jQuery.ajax({
        url:'/authc/dologin',
        dataType:'json',
        type:'POST',
        data:{userName : userName, password : password },
        success:function(data) {
            if(data.code == 0){
               window.location.href="/";
            }else{
                $("#errorMsg").html(data.data);
                $("#errorMsg").css("display","block");
            }} });
});


$(function(){
    $("#userName").focus();
});